﻿using System;
using System.IO;

namespace Samurai.Crawler
{
    /// <summary>
    /// Information about the file in the current directory.
    /// </summary>
    public class FileEventArgs : EventArgs
    {
        #region Constructors

        /// <summary>
        /// Block the default constructor.
        /// </summary>
        private FileEventArgs() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="DirectoryEventArgs"/> class.
        /// </summary>
        /// <param name="fileInfo"><see cref="FileInfo"/> object for the current file.</param>
        internal FileEventArgs(FileInfo fileInfo)
        {
            if (fileInfo == null) throw new ArgumentNullException("fileInfo");

            // Get File information 
            _fileInfo = fileInfo;
        }

        #endregion

        #region Properties

        private bool _cancel;
        private FileInfo _fileInfo;

        /// <summary>
        /// Gets the current file information.
        /// </summary>
        /// <value>The <see cref="FileInfo"/> object for the current file.</value>
        public FileInfo Info
        {
            get { return _fileInfo; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether to cancel the directory scan.
        /// </summary>
        /// <value>
        /// <see langword="true"/> if the scan must be cancelled; otherwise, <see langword="false"/>.
        /// </value>
        public bool Cancel
        {
            get { return _cancel; }
            set { _cancel = value; }
        }

        #endregion
    }
}